/**
 * 限额新增
 */
angular.module('inspinia',['angularFileUpload']).controller('updateTransLimitWhiteCtrl',function($scope,$http,i18nService,$state,FileUploader,$stateParams){
    i18nService.setCurrentLang('zh-cn');  //设置语言为中文

    $scope.limitActiones= [{text:"请选择业务类型",value:""},{text:"限制交易",value:"TRANS"},{text:"限制额度",value:"QUOTA"}];
    $scope.info={};

    $scope.getDatailInfo=function(){
        $http.post('transLimit/selectTransLimitWhiteDetail',
            "id="+$stateParams.id,
            {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
            .success(function(data){
                if(data.status){
                    $scope.info=data.data;
                }
            })
    };
    $scope.getDatailInfo();

    $scope.submitting = false;
    $scope.commitInfo=function () {
        if($scope.submitting){
            return;
        }
        $scope.submitting = true;
        $http.post("transLimit/updateTransLimitWhite","info="+angular.toJson($scope.info),
            {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
            .success(function(data){
                $scope.submitting = false;
                if(data.status){
                    $scope.notice(data.msg);
                    $state.transitionTo('risk.transLimitWhiteList',null,{reload:true});
                }else{
                    $scope.notice(data.msg);
                }
            })
            .error(function(data){
                $scope.submitting = false;
                $scope.notice(data.msg);
            });
    };
});